﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Drawing;
using System.Drawing.Imaging;

namespace ChartControls
{
    [DefaultProperty("Text")]
    [ToolboxData("<{0}:ServerControl1 runat=server></{0}:ServerControl1>")]
    public class ServerControl1 : WebControl
    {
        [Bindable(true)]
        [Category("Appearance")]
        [DefaultValue("")]
        [Localizable(true)]
        public string Text
        {
            get;
            set;
        }


        [Bindable(true)]
        [Category("Appearance")]
        [DefaultValue("")]
        [Localizable(true)]
        public string aaaa
        {
            get;
            set;
        }

        [Bindable(true)]
        [Category("Appearance")]
        [DefaultValue("")]
        [Localizable(true)]
        public int ChartWidth
        {
            get;

            set;
        }

        protected override void RenderContents(HtmlTextWriter output)
        {
            output.Write("<img src='getimage.aspx'/>");
        }

        public Bitmap CreateChart()
        {
            Bitmap bitMap = new Bitmap(100, 100);
            Graphics g = Graphics.FromImage(bitMap);
            Brush solidBrush = new SolidBrush(Color.Lime);

            Font  font = new Font("Consolas", 20);
            g.DrawString("hello world",font,solidBrush,1,2);

          
            g.Dispose();

            return bitMap;
        }
    }
}
